package day10_poly.demo02_ploy;

public class Person {
    private Animal animal;
    public Person(Animal animal) {
        this.animal = animal;
    }
    public Person() {
    }
    public void feed(){
        animal.eat();
    }
    public void play(){
        if (animal instanceof Cat){
            Cat cat=(Cat)animal;
            cat.play();
        }else{
            Dog dog=(Dog)animal;
            dog.play();
        }
    }
}
